<script>
$(document).ready(function() {    
    $( ".new_regis" ).click(function() {   
     $('#hidParameterID').val($(this).attr('rel'));  
     //alert($(this).attr('rel'));
     $('#frmCompanyCode').attr('action', '<?php echo base_url();?>pit-rules/add');  
     $( "#frmCompanyCode" ).submit();
    });  
 });   
</script>
<div id="main_content">
	<h3><?php echo  $this->lang->line('h_PITrules'); ?> </h3>
        <a  rel="<?php echo isset($ParameterId) ? $ParameterId : '' ?>" href="javascript:void(0);" class="new_regis"><?php echo $this->lang->line('MC007'); ?></a>
    <div class="table_list">
		<?php
           echo "<label for='disabledSelect' style='color:red;'>".$this->session->flashdata('message')."</label>";
        ?>
    	<table width="100%" border="0"  class="list_view_data" cellpadding="0" cellspacing="0">
            <tr align="center">
                <th width="15%"><?php echo  $this->lang->line('h_no'); ?></th>
                <th width="15%"><?php echo  $this->lang->line('h_Level'); ?></th>
                <th width="35%"><?php echo $this->lang->line('h_AssociatedAmount'); ?></th>
                <th width="15%"><?php echo $this->lang->line('h_Rate'); ?> </th>
                <th width="10%"><?php echo $this->lang->line('h_Action'); ?></th>  
                <th><?php echo $this->lang->line('spl__Delete'); ?></th>
            </tr>
            <?php  $count =$page+ 1; foreach($data as $row){
                $path=($row['Del_Flag']==0) ? base_url()."public/sites/images/check-icon.png" : base_url()."public/sites/images/uncheck.gif";
                ?>
                <tr>
                	<td align="center" width="50"><?php echo $count++; ?></td>
                    <td align="center" width="50"  >
                        <?php echo $row['Level']; ?>
                    </td>
                    <td align="right" width="150"><?php echo number_format( $row['AssociatedAmount'],2, '.', ','); ?></td>
                    <td align="right" width="50"><?php echo $row['Rate']*100; ?> %</td>
                    <td align="right">
                        <a class="edit" rel="<?php echo $row['ParameterId']; ?>-<?php echo $row['PITCalculationRuleId'] ?>" href="javascript:void(0);">
                            <img src="<?php echo base_url();?>public/sites/images/Pencil.png" width="15" />
                        </a>
                    </td>
                    <td align="center"><img src="<?php echo $path;?>"/></td>
                </tr>                
            <?php  }  ?>    
                                                                                               
        </table>
        <label for='disabledSelect' > <?php echo $messsageError; ?></label>
    </div>
        <div class="h_pagination">
        <?php echo $pagination;  ?>
    </div>
</div>

<form id="frmCompanyCode" action="" method="POST">
  <input type="hidden" id="hidParameterID" name="hidParameterID">  
  <!--<input type="hidden" id="hidPITCalculationRuleId" name="hidPITCalculationRuleId">-->  
</form>

<script>
$( ".edit" ).click(function() {   
    //alert($(this).attr('rel'));
     $('#hidParameterID').val($(this).attr('rel'));    
     $('#frmCompanyCode').attr('action', '<?php echo base_url();?>pit-rules/edit');  
     $( "#frmCompanyCode" ).submit();
});

  

$(document).ready(function() {
        $('.h_pagination a').click(function(e) {            
            e.preventDefault();            
            $('#hidParameterID').val('<?php echo $row['ParameterId']; ?>');
            var url = $(this).attr('href');            
            if (url != 'javascript:void(0)') { 
                //$(this).attr('rel', '<?php echo $row['ParameterId']; ?>-<?php echo $row['PITCalculationRuleId'] ?>')
                 
                $('#frmCompanyCode').attr('action', url);
                $('#frmCompanyCode').submit();
                
            }
        });
 });        
</script>